import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
////import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class GoBang extends MIDlet
{

	private GameEngine engine;
	static public Display    s_display;
	static public  GoBang s_midlet;
	private GameView	   viewA;
	///private GameManage	   gameManageA;

	
	public GoBang() {
		s_midlet = this;
	}
	
	/* (non-Javadoc)
	 * @see javax.microedition.midlet.MIDlet#startApp()
	 */
	protected void startApp() ////throws MIDletStateChangeException 
	{
		if(this.s_display==null)
		{
		/*GameModel model = new GameModel(10, 10, 50, 50, 5);
		this.viewA = new GameView(model, 0xFF0000);
       */
		this.engine = new GameEngine(/*model,*/ 12);
		///this.gameManageA = this.engine.gameManage;
		this.viewA = new GameView(this.engine );
		
		///Displayable drawingArea = this.engine.getDrawingArea(); 
		this.engine.attach(viewA);
		this.s_display = Display.getDisplay(this);
		}
		this.s_display.setCurrent(this.engine.getDrawingArea());
		this.engine.start();
	}
	
	/* (non-Javadoc)
	 * @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
	 */
	protected void destroyApp(boolean arg0) {}

	/* (non-Javadoc)
	 * @see javax.microedition.midlet.MIDlet#pauseApp()
	 */
	protected void pauseApp() {}
	
	public static void quitApp()
	{
	    s_midlet.notifyDestroyed();
	    s_midlet = null;
	}
	
}
